#ifndef MULTIVALUEITEM_H
#define MULTIVALUEITEM_H


#include "models_global.h"
#include "AbstractItem.h"


#include <QSharedData>
#include <QSharedDataPointer>



class MODELSSHARED_EXPORT MultiValueItem : public AbstractItem
{
    Q_OBJECT

    class Data : public QSharedData
    {
    public:
        Data() {}
        Data(const Data& other) : QSharedData(other)
        {
             values = other.values;
        }

        QVariantMap values;
    };


public:

    enum DataType
    {
        UserField = AbstractItem::DataType_LAST + 1
    };

    Q_INVOKABLE MultiValueItem(AbstractItem* parent = 0);
    MultiValueItem(const MultiValueItem& other) : AbstractItem(other)
    {
        d = other.d;
    }


    virtual int fieldCount() const;

    virtual QString fieldName(const int &field) const;
    virtual int field(const QString& name) const;

    virtual void setField(const QString& name, const QVariant& data = QVariant());


protected:

    virtual void setCustomData(const int& field, const QVariant& data);
    virtual QVariant customData(const int& field, int role = Qt::DisplayRole) const;


private:

    QSharedDataPointer<Data> d;

    friend class MultiValueItem;


};


Q_DECLARE_METATYPE(MultiValueItem*);


#endif // MULTIVALUEITEM_H
